<?php

namespace App\Modules\Admin\Entities\Log;

use App\Models\Model;

class OrderJundaLogModel extends Model
{

    protected $table='order_junda_log';
    protected $primaryKey='id';
    public $timestamps=false;

    public function paramsLog($params)
    {
        $desc = json_encode($params);
        $insert = [
            'mid'=>$params['mid'],
            'conchannel'=>$params['conchannel'],
            'conwater'=>$params['conwater'],
            'iseff'=>$params['iseff']??0,
            'created_time'=>date('Y-d-m H:i:s'),
            'updated_time'=>date('Y-d-m H:i:s'),
            'desc'=>$desc
        ];

        if(isset($params['conMoney'])){
            $insert['buy_money'] = $params['buyMoney'];
            $insert['con_money']= $params['conMoney'];
            $insert['equipment_id'] = $params['equipmentId'];
            $insert['order_no'] = $params['orderNo'];
            $insert['card_no']= $params['cardNo'];
        }else{
            $insert['buy_money'] = $params['buymoney'];
            $insert['con_money']= $params['conmoney'];
            $insert['equipment_id'] = $params['equipmentid'];
            $insert['order_no'] = $params['orderno'];
            $insert['card_no']= $params['cardno'];
        }


        return $this->create($insert);
    }
}
